# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=avet
pkgver=560.6da43bf
pkgrel=1
pkgdesc='AntiVirus Evasion Tool.'
arch=('any')
groups=('blackarch' 'blackarch-binary' 'blackarch-backdoor' 'blackarch-automation')
url='https://github.com/govolution/avet'
license=('GPL3')
depends=('python' 'python-certifi' 'python-contourpy' 'python-cycler'
         'python-idna' 'python-charset-normalizer' 'python-fonttools'
         'python-joblib' 'python-matplotlib' 'python-lief' 'python-pillow'
         'python-requests' 'python-scipy' 'python-sympy' 'python-dateutil'
         'python-networkx' 'python-mpmath' 'python-kiwisolver'
         'python-threadpoolctl' 'python-typing_extensions' 'python-urllib3'
         'wine' 'wine-mono' 'wine_gecko')
makedepends=('git')
source=("git+https://github.com/govolution/$pkgname.git"
        'setup.patch')
install="$pkgname.install"
sha512sums=('SKIP'
            '57475665a28d192b2842f1ceb46086718457470064bede2fc1c70755295a49553317bcc463d29a23e64bca78fa873919fd3b3799a17b510abee8da500a2760d5')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

prepare() {
  cd $pkgname

  patch setup.sh < "$srcdir/setup.patch"
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname" README.md
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  cp -a --no-preserve=ownership * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python $pkgname.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

